Skip to content

feat(ChatMessage): add color prop and header slot#6407

Open
maximepvrt wants to merge 9 commits intonuxt:v4from
maximepvrt:messages
Open

feat(ChatMessage): add color prop and header slot#6407
maximepvrt wants to merge 9 commits intonuxt:v4from
maximepvrt:messages

Conversation

@maximepvrt
Copy link
Copy Markdown
Contributor

🔗 Linked issue

❓ Type of change

  • 📖 Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • 👌 Enhancement (improving an existing functionality)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

📚 Description

📝 Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@github-actions github-actions Bot added the v4 #4488 label Apr 28, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 28, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds a new color variant to the ChatMessage theme (colors derived from theme colors plus an explicit neutral) and sets defaultVariants.color = 'neutral'. Visual styling for color+variant combinations was moved into compoundVariants. Introduces a header slot (and slot wrapper) and removes bottom margin from the files slot. The ChatMessage component gains a color prop, forwards it into the component UI config, and exposes the optional header slot. Documentation for the color prop, a Nuxt playground page with color/variant controls, navigation inclusion, and tests covering color and header were added. No public APIs removed.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Description check ❓ Inconclusive The PR description is essentially empty with only template boilerplate, containing no meaningful information about the changes or their rationale. Add a brief description explaining what the color prop and header slot accomplish, why they were added, and any relevant usage examples or context.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The PR title 'feat(ChatMessage): add color prop and header slot' directly and concisely describes the main changes: adding a color prop and header slot to ChatMessage.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
playgrounds/nuxt/app/pages/components/chat-message.vue (1)

19-21: Consider adding required props to UChatMessage.

The UChatMessage component requires id, role, and parts props (or the deprecated content). While content is provided, consider using the recommended parts format with proper id and role for a complete example:

♻️ Suggested enhancement
   <Matrix v-slot="props" :attrs="attrs">
-    <UChatMessage content="My message" v-bind="props" />
+    <UChatMessage
+      id="demo-message"
+      role="user"
+      :parts="[{ type: 'text', text: 'My message' }]"
+      v-bind="props"
+    />
   </Matrix>
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@playgrounds/nuxt/app/pages/components/chat-message.vue` around lines 19 - 21,
The UChatMessage usage currently passes only the deprecated content prop; update
the Matrix slot render to provide UChatMessage with the required props: include
a unique id, a role (e.g., "user" or "assistant"), and the parts array (instead
of content) constructed from the slot props; locate the Matrix v-slot and
replace the UChatMessage attributes so it receives id, role and parts (e.g.,
parts: [{ content_type: "text", text: "My message" }]) while still binding
remaining props via v-bind="props".
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@playgrounds/nuxt/app/pages/components/chat-message.vue`:
- Around line 19-21: The UChatMessage usage currently passes only the deprecated
content prop; update the Matrix slot render to provide UChatMessage with the
required props: include a unique id, a role (e.g., "user" or "assistant"), and
the parts array (instead of content) constructed from the slot props; locate the
Matrix v-slot and replace the UChatMessage attributes so it receives id, role
and parts (e.g., parts: [{ content_type: "text", text: "My message" }]) while
still binding remaining props via v-bind="props".

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: bb48fc2c-84bf-4283-9508-db1616c6bbfd

📥 Commits

Reviewing files that changed from the base of the PR and between 4587079 and 28cc3f1.

⛔ Files ignored due to path filters (4)
  • test/components/__snapshots__/ChatMessage-vue.spec.ts.snap is excluded by !**/*.snap
  • test/components/__snapshots__/ChatMessage.spec.ts.snap is excluded by !**/*.snap
  • test/components/__snapshots__/ChatMessages-vue.spec.ts.snap is excluded by !**/*.snap
  • test/components/__snapshots__/ChatMessages.spec.ts.snap is excluded by !**/*.snap
📒 Files selected for processing (6)
  • docs/content/docs/2.components/chat-message.md
  • playgrounds/nuxt/app/composables/useNavigation.ts
  • playgrounds/nuxt/app/pages/components/chat-message.vue
  • src/runtime/components/ChatMessage.vue
  • src/theme/chat-message.ts
  • test/components/ChatMessage.spec.ts

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
playgrounds/nuxt/app/pages/components/chat-message.vue (1)

19-21: Consider showcasing the new header slot in this playground.

This page already demonstrates the new color behavior well; adding a simple #header example would make the slot addition easier to discover interactively.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@playgrounds/nuxt/app/pages/components/chat-message.vue` around lines 19 - 21,
Add a small example of the new header slot to the playground by updating the
UChatMessage usage inside the Matrix v-slot block: keep the existing props and
parts but add a header slot (e.g., a <template `#header`> or v-slot:header on
UChatMessage) that renders simple header content like a title, role label or
timestamp so users can interactively see the new header slot behavior alongside
the existing color demo; modify the Matrix v-slot="props" / UChatMessage id="1"
block to include that header slot example.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@playgrounds/nuxt/app/pages/components/chat-message.vue`:
- Around line 19-21: Add a small example of the new header slot to the
playground by updating the UChatMessage usage inside the Matrix v-slot block:
keep the existing props and parts but add a header slot (e.g., a <template
`#header`> or v-slot:header on UChatMessage) that renders simple header content
like a title, role label or timestamp so users can interactively see the new
header slot behavior alongside the existing color demo; modify the Matrix
v-slot="props" / UChatMessage id="1" block to include that header slot example.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 4421a0cd-6c48-440d-b519-6e11e0c25535

📥 Commits

Reviewing files that changed from the base of the PR and between 28cc3f1 and d038310.

📒 Files selected for processing (1)
  • playgrounds/nuxt/app/pages/components/chat-message.vue

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Apr 28, 2026

npm i https://pkg.pr.new/@nuxt/ui@6407

commit: fe649c1

Comment thread src/theme/chat-message.ts Outdated
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
test/components/ChatMessage.spec.ts (1)

31-31: ⚡ Quick win

header slot test only checks render, not slot-prop forwarding.

The new with header slot case verifies the slot renders without error, which is the minimum bar. The PR summary notes the header slot can receive slot props (e.g., files as a fallback). If the slot exposes any props, there is no assertion that confirms they are correctly forwarded — analogous to the existing forwards id, role, parts, metadata and content test for the content slot.

Consider adding a dedicated test that captures the header slot's props and asserts their shape, matching whatever ChatMessage.vue exposes.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@test/components/ChatMessage.spec.ts` at line 31, The 'with header slot' test
only verifies render but doesn't assert that slot props are forwarded; update
the ChatMessage.spec.ts case named 'with header slot' to provide the header slot
as a function that captures the received slotProps into a variable and assert
its shape/values (e.g., that it includes the expected files fallback or whatever
props ChatMessage.vue exposes). Mirror the pattern used in the existing
"forwards id, role, parts, metadata and content" test: render the header slot as
a function, capture slotProps, and add assertions on keys/types/expected values
to confirm proper forwarding from ChatMessage.vue.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@test/components/ChatMessage.spec.ts`:
- Line 31: The 'with header slot' test only verifies render but doesn't assert
that slot props are forwarded; update the ChatMessage.spec.ts case named 'with
header slot' to provide the header slot as a function that captures the received
slotProps into a variable and assert its shape/values (e.g., that it includes
the expected files fallback or whatever props ChatMessage.vue exposes). Mirror
the pattern used in the existing "forwards id, role, parts, metadata and
content" test: render the header slot as a function, capture slotProps, and add
assertions on keys/types/expected values to confirm proper forwarding from
ChatMessage.vue.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: d4140912-6446-447f-bbb4-0b287aca9348

📥 Commits

Reviewing files that changed from the base of the PR and between 5f278c3 and 736ee06.

📒 Files selected for processing (2)
  • src/runtime/components/ChatMessage.vue
  • test/components/ChatMessage.spec.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/runtime/components/ChatMessage.vue

@maximepvrt maximepvrt requested a review from benjamincanac May 10, 2026 19:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

v4 #4488

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants